Repository navigation
Preserve history session boundaries across list mutations - #1795
Conversation
Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1795 +/- ##
=======================================
Coverage 99.75% 99.75%
=======================================
Files 23 23
Lines 6574 6624 +50
=======================================
+ Hits 6558 6608 +50
Misses 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
tleonhardt
left a comment
There was a problem hiding this comment.
Missing CHANGELOG entry
#1787 added a Bug Fixes entry for truncate() under 4.4.0, and this change is the same kind of fix to a public API. Something like:
Fixed deleting, popping, removing, inserting, or slice-assigning History entries before the current session leaving session_start_index stale.
|
I merged main into this branch which includes a fix for a test that was intermittently failing for free-threaded Python variants. |
Track retained persisted entries by identity when a replacement spans the session boundary. In-place filtering now agrees with deleting the same entries, including repeated command values. Add filtering, reordering and failed-replacement controls, and record the public History mutation fix under 4.4.0. Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
Removing or inserting entries before
session_start_indexcurrently leaves it pointing at the wrong place, so unbounded history ranges and searches omit current-session commands or include persisted ones.Adjust the existing boundary after successful list mutations, including slices,
pop()andremove(). When a replacement spans the boundary, recognize the leading retained persisted entries by identity. In-place filtering then agrees with deleting the same entries, and equal commands from different sessions are kept distinct. Self-assignment remains stable; in-place repetition that clears history resets the boundary.truncate()uses the shared deletion handling, and the public API fix is recorded under 4.4.0 in the changelog.Validation on macOS:
a77a1a5b, 21 revised/new cases fail.make check,make testand strictmake docs-testpass on Python 3.12: 2,914 tests passed and five skipped, with 100% statement coverage forhistory.py(99.4% overall).make checkand strict docs also pass on the CI quality/docs Python 3.15 runtime. Wheel and source distribution builds pass.Linux and Windows remain for CI.
Closes #1788.